<template>
  <div class="goods">
    <ul>
      <li v-for="item in goodsList" :key="item.id" @click="gotoDetail(item)">
        <img :src="item.list_pic_url" alt="" />
        <p>{{ item.name }}</p>
        <span>{{ item.retail_price |formatMoney}}</span>
      </li>
    </ul>
  </div>
</template>
<script>
export default {
  name: "",
  props: ["goodsList"],
  data() {
    return {};
  },
  components: {},
  methods: {
    gotoDetail(item){
      // console.log(item);
      this.$router.push({'path':'/productDetail',query:{id:item.id}})
    }
  },
  created() {},
};
</script>
<style lang='less' scoped>
.goods {
  ul {
    display: flex;
    flex-wrap: wrap;
    li {
      width: 50%;
      padding: 3px;
      box-sizing: border-box;
      img {
        width: 100%;
        display: block;
      }
      p {
        font-size: 18px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      span {
        font-size: 16px;
        text-align: center;
        margin-left: 40px;
        color: purple;
      }
    }
  }
}
</style>